package com.example.tool.adapter;

import android.content.Context;
import android.support.annotation.NonNull;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.example.tool.R;
import com.example.tool.dao.entity.Person;

import java.util.List;

/**
 * Created Date 2019/9/23
 *
 * @author liangkun
 * description：数据库适配器
 */
public class DbPopAdapter extends BaseQuickAdapter<Person, BaseViewHolder> {
    private Context context;


    public DbPopAdapter(Context context, List<Person> list) {
        super(R.layout.db_pop_item, list);
        this.context = context;
    }

    /**
     * Implement this method and use the helper to adapt the view to the given item.
     *
     * @param helper A fully initialized helper.
     * @param item   The item that needs to be displayed.
     */
    @Override
    protected void convert(@NonNull BaseViewHolder helper, Person item) {
        helper.setText(R.id.tv_item_name, item.getPersonName()).linkify(R.id.tv_item_name);
        helper.setText(R.id.tv_item_age, String.valueOf(item.getPersonAge())).linkify(R.id.tv_item_age);
        helper.setText(R.id.tv_item_date, item.getPersonBirthday()).linkify(R.id.tv_item_date);
        helper.setText(R.id.tv_item_gender, item.getPersonGender()).linkify(R.id.tv_item_gender);

    }

}
